#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<string>
using namespace std;

//bool isPrime(int num) {
//    if (num <= 1) {
//        return false;
//    }
//
//    for (int i = 2; i * i <= num; i++) {
//        if (num % i == 0) {
//            return false;
//        }
//    }
//
//    return true;
//}
//
//int main() {
//    int n = 0;
//    for (int i = 1; i < 20210610; i++)
//    {
//        if (isPrime(i))
//            n++;
//    }
//    cout << n << endl;
//    return 0;
//}
int main()
{
	int day;
	int n = 0;
	int sumyear[21] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5
	};
	int summon[13] = { 0,1,2,3,4,5,6,7,8,9,1,2,3 };
	int sumday[32] = { 0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,11,3,4};
	int year = 2021;
	for (int i = 0; i < 21; i++)
	{
		int sum = 0;
		for (int j = 1; j <=12; j++)
		{
			if (j == 1 || j == 3 || j == 5 || j == 7 || j == 8 || j == 10 || j==12)
			{
				day = 31;
			}
			else
				day = 30;
			for (int k = 1; k <= day; k++)
			{
				if (((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) && k == 29&&j==2)
					break;
				if (j == 2 && k == 30)
					break;
				sum = sumyear[i] + sumday[j]+sumday[k];
				double sum1 = sqrt(sum);
				int  sum2= (int)sqrt(sum);
				if (sum1 == sum2)
				{
					n++;
				}
		     }

		}
		year++;
	}
	cout << n << endl;
	return 0;
}